<include file="../Public/_header.html" />
<div class="so_main">
			
			<!-------- 搜索开始 -------->
		  <div id="search_div">
		  	<div class="page_tit">
		  		搜索商品 [ <a href="javascript:void(0);" onclick="_show_searcharea();">隐藏</a> ]
		  	</div>
				<div class="sform">
					<form method="post" action="{:U('/Goods/index')}" id="searchForm">
						<input id="pno" name="pno" type="hidden" value="1">
					    <dl>
					    	
					      <span>选择商户：</span>
					        <input id="partnerdesc" type="text" value="{:getParnterTitle($partner_id)}"
					        onclick="k_pop_syncSearch('partner_id'
					        													,'partnerdesc'
					        													,'选择商户'
					        													,'{:U('Admin://Partner/getJson')}'
					        													,null
					        													,null)" 
					        readonly >
					        <input name="partner_id" id="partner_id" type="hidden" value="{$partner_id}">
					      
					      
					      <span>商品分类：</span>
					      
						    	<input id="sortdesc" type="text" value="{$sort_id|getCategoryName}" 
					      					onclick="ui.box.load(
					    											'{:U('Index://Public/showtree',array('code'=>'goods'))}'
					    											,{ title:'查看商品分类' })"
					      					readonly>
					      	<input id="sort_id" name="sort_id" type="hidden" value="{$sort_id}">
									<script>
											function _tmp_setselectdict(rel,txt){
									    		$('#sortdesc').val(txt);
									    		$('#sort_id').val(rel);
									    }
									</script>
								<span>是否有效：</span>
					      	<input name="enable" type="radio" value="all" <eq name="enable" value="all">checked</eq>>全部
					        <input name="enable" type="radio" value="Y" <eq name="enable" value="Y">checked</eq>>是
					        <input name="enable" type="radio" value="N" <eq name="enable" value="N">checked</eq>>否
					    	<span>&nbsp;&nbsp;&nbsp;</span>
					    	<input type="submit" class="btn_b" value="提交" />
					    </dl>
					</form>
			  </div>
		  </div>
		  <!-------- 搜索结束 -------->
	
  <div class="page_tit">商品管理</div>
  <div class="Toolbar_inbox">
  	<a href="javascript:void(0);" class="btn_a" onclick="_show_searcharea();">
		<span>条件搜索</span>
		</a>
    <a href="javascript:void(0);" class="btn_a" onclick="del();"><span>删除商品</span></a>
  </div>
  
  <div class="list">
  <table id="goods_list" width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th style="width:30px;">
        <input type="checkbox" id="checkbox_handle" onclick="table_checkAll(this)" value="0">
        <label for="checkbox"></label>
    </th>
    <th class="line_l">ID</th>
    <th class="line_l" style="text-align:center"
	    	title="户、品、价：对应商户、商品、价格，表示其各自是否有效。E代表对应数据为空。"
	    	>户&nbsp;品</th>
    <th class="line_l">名称</th>
    <th class="line_l">兑换方式</th>
    <th class="line_l">商户</th>
    <th class="line_l" style="text-align:right">分类</th>
    <th class="line_l" style="text-align:center">开始时间</th>
    <th class="line_l" style="text-align:center">截止时间</th>
    <th class="line_l" style="text-align:right">总进货量</th>
    <th class="line_l" style="text-align:right">总卖出量</th>
    <th class="line_l" style="text-align:right">总剩余量</th>
    <th class="line_l" style="text-align:center">操作</th>
  </tr>
  <volist id="vo" name="pagedata['data']">
      <tr overstyle='on' id="goods_{$vo.id}">
        <td><input type="checkbox" name="checkbox" id="checkbox2" onclick="table_checkon(this)" value="{$vo.id}"></td>
        <td>{$vo.id}</td>
        
        <td style="text-align:center;padding: 6px 0 6px 0px;color:red">
        	{:getParnterEnable($vo['partner_id'])}&nbsp;&nbsp;{$vo['enable']}</td>
        
        
        <td>
        	
        		<div style="float: left; margin-right: 10px; border: 1px solid rgb(128, 152, 168); height: 30px; padding: 1px; width: 30px;">
							<img width="30" height="30" src="{:getAttachUrl($vo['goods_icon'])}">
						</div>
						<div style="float: left;">
							<a href="{:U('/Goods/index',array('good_id'=>$vo['id']))}" id="goods_title_{$vo.id}">{$vo.title}</a>
							<br>
							<font style="font-size:10px">
							</font>
						</div>
        	
        	
        	<div style="float:left">

        	</div></td>
        <td>{$vo['get_type']|getGoodsGetTypeDesc}</td>
        
        <td><div style="float:left">
        	<a href="{:U('/Partner/index',array('parent_id'=>$vo['partner_id']))}">{$vo['partner_id']|getParnterTitle}</a></div></td>
        
        <td><div style="float:right">

        	<a href="{:U('/Goods/index',array('sort_id'=>$vo['sort_id']))}">{$vo['sort_id']|getCategoryName}</a></div></td>
 
 				<td style="text-align:center">{:paramMillisecond2Date($vo['start_time'],'Y-m-d')}</td>
   
        <td style="text-align:center">{:paramMillisecond2Date($vo['expire_time'],'Y-m-d')}</td>
   
        <td style="text-align:right">
	        	<span>{$vo['total_number']}</span>
        </td>
        <td style="text-align:right">
	        	<span>{$vo['send_number']}</span>
        </td>
        
        <td style="text-align:right">
	        	<span><php> echo $vo['total_number']-$vo['send_number'];</php></span>
        </td>
        
        
        <td style="text-align:center">
            <a href="{:U('/Goods/editGood',array('id'=>$vo['id']))}" >编辑</a>&nbsp;&nbsp;
            <a href="javascript:void(0);" onclick="del({$vo['id']});">删除</a>&nbsp;&nbsp;
            <a href="javascript:void(0);" 
            		onclick="k_pop_goodsprice('{:U('Admin://Price/getAvailabePrice')}'
					        				,'{$vo['id']}'
					        				,'商品 {$vo.title} 当前价格');" title="查看当前价格">当前</a>&nbsp;&nbsp;
            <a href="{:U('/Price/index', array('goods_id'=>$vo['id']))}" title="查看全部价格" >全部</a>
        </td>
      </tr>
  </volist>
  </table>

  </div>
  <div class="Toolbar_inbox">
    <div class="page_box">{$pagedata['html']}</div>
  </div>
</div>
  <div class="clear"></div>
<script>
    //鼠标移动表格效果
    $(document).ready(function(){
    	table_init();
    });
    
    //删除分类
    function del(aid) {
        aid = aid ? aid : table_getChecked();
        aid = aid.toString();
        if(aid == '') return false;
		if(!confirm('确定删除么？')){
				return;
		}
        //提交删除
        $.post("{:U('/Goods/doDeleteGood')}", {ids:aid}, function(res){
	        if(res == '1') {
		        aid = aid.split(',');
		        $.each(aid, function(i,n){
		            $('#partner_'+n).remove();
		        });
	            ui.success('删除成功');
	        }else {
	        	ui.success('删除失败');
	        }
        });
        
        
    }
</script>

<include file="../Public/_footer.html" />